package com.netstar.salesman_90dsp.tool;

import android.app.ProgressDialog;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.view.Window;

import com.netstar.salesman_90dsp.R;

public class DialogTool {
	private Context context;
	/**
	 * 等待类型
	 */
	public final static int VIEW_ID_CALENDAR = R.id.common_id_calendar_view;

	public DialogTool(Context context) {
		super();
		this.context = context;
	}

	/**
	 * 获得通用等待框
	 * 
	 * @param layoutResource
	 * @param message
	 * @return
	 */
	public WaittingDialog getWaittingDialog(int layoutResource, String message) {
		WaittingDialog waittingAlertDialog;
		if (layoutResource < 0) {
			layoutResource = R.layout.common_dialog_wait_layout;
		}
		if (TextUtils.isEmpty(message)) {
			message = "操作中。。。";
		}
		waittingAlertDialog = new WaittingDialog(context, layoutResource,
				message);
		// 设置点击屏幕Dialog不消失
		waittingAlertDialog.setCancelable(false);
		return waittingAlertDialog;
	}

	/**
	 * 获得通用 日期选择框
	 * 
	 * @param layoutResource
	 * @param message
	 * @return
	 */
	public DateChooseDialog getDateChooseDialog(int layoutResource,
			int calendarId) {
		DateChooseDialog dateChooseDialog;
		dateChooseDialog = new DateChooseDialog(context, layoutResource,
				calendarId);
		return dateChooseDialog;
	}

	/**
	 * 获得通用 日期选择框
	 * 
	 * @param layoutResource
	 * @param message
	 * @return
	 */
	public DateChooseDialog getDateChooseDialog(View resLayoutView,
			int calendarId) {
		DateChooseDialog dateChooseDialog;
		dateChooseDialog = new DateChooseDialog(context, resLayoutView,
				calendarId);
		return dateChooseDialog;
	}

	public ProgressDialog getProgressDialog(String title, String message) {
		ProgressDialog progressDialog;
		progressDialog = ProgressDialog.show(context, title, message, false);
		progressDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
		return progressDialog;

	}
}
